package com.shhm.system.controller;

import com.shhm.common.dto.response.AjaxResultPlus;
import com.shhm.common.entity.BaseEntity;
import com.shhm.common.entity.admin.SysUser;
import com.shhm.system.dto.request.RegisterReq;
import com.shhm.system.service.RegisterService;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

/**
 * @author JackZ
 * @version 1.0
 * @description: TODO
 * @date 2025/9/18 下午4:17
 */
@RestController
@RequestMapping("/public")
public class RegisterController {
    @Resource
    private RegisterService registerService;

    @PostMapping("/register/{captcha}")
    public AjaxResultPlus register(@RequestBody SysUser req, @PathVariable String captcha, HttpServletRequest request) {
        return registerService.register(req,captcha, request);
    }

    @RequestMapping("/register/captcha")
    public AjaxResultPlus getCaptcha(HttpServletRequest request) throws IOException {
        return registerService.getCaptcha(request);
    }
}
